<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    
    <!-- 引入 echarts.js -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Bootstrap -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <title>ECharts</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/4.1.0/echarts-en.common.js"></script>
    <style>
    .container {
        width:800px;
    }

    #main {
        height: 600px;
        width: 750px;
        margin: 20px auto;
    }
    h1 {
        color: blue;
    }
    
    </style>
</head>
<body>
    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
     <div class="container">
        <h1>2016与2017年化妆品行业搜索排行榜 <small>数据可视图表</small></h1>
        <div id="main"></div>
        <div class="panel panel-primary">
            <div class="panel-heading">数据来源</div>
            <div class="panel-body">
                <p><li><a href="http://index.baidu.com/Helper/?tpl=brand&word=">百度指数</a></li></p>
                
            </div>
        </div>
    </div>
    <script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));

        // 指定图表的配置项和数据
  
var data = [
    [[43842135,1,4384213567,'雅诗兰黛',2017],[41324181,2,3132418110,'兰蔻',2017],[41280332,3,2128033110,'圣罗兰',2017],[37732348,4,1773234811,'迪奥',2017],[32712661,5,1271266100,'香奈儿',2017],[24675130,6,926751300,'雪花秀',2017],[32712661,7,807126600,'巴黎欧莱雅',2017],[22553628,8,625536000,'科颜氏',2017],[21508353,9,415083530,'雅漾',2017],[20790094,10,201900940,'悦诗风吟',2017]],
   
    [[39712714,1,3984213567,'兰蔻',2016],[35009107,1,2132418110,'雅诗兰黛',2016],[33923416,3,1128033110,'香奈儿',2016],[32950361,4,1373234811,'悦诗风吟',2016],[32476399,5,1221266100,'雪花秀',2016],[28799712,6,976751300,'圣罗兰',2016],[27973492,7,607126600,'雅漾',2016],[27890061,8,655536000,'迪奥',2016],[27237100,9,515083530,'兰芝',2016],[24968069,10,249780790,'巴黎欧莱雅',2016]]
    
];

 var option = {
    backgroundColor: new echarts.graphic.RadialGradient(0.3, 0.3, 0.8, [{
        offset: 0,
        color: '#f7f8fa'
    }, {
        offset: 1,
        color: '#cdd0d5'
    }]),
    title: {
        text: '2016与2017年化妆品行业搜索排行榜'
    },
    legend: {
        right: 10,
        data: ['2017', '2016']
    },
    xAxis: {
        splitLine: {
            lineStyle: {
                type: 'dashed'
            }
        }
    },
    yAxis: {
        splitLine: {
            lineStyle: {
                type: 'dashed'
            }
        },
        scale: true
    },
    series: [{
        name: '2017',
        data: data[0],
        type: 'scatter',
        symbolSize: function (data) {
            return Math.sqrt(data[2]) / 5e2;
        },
        label: {
            emphasis: {
                show: true,
                formatter: function (param) {
                    return param.data[3];
                },
                position: 'top'
            }
        },
        itemStyle: {
            normal: {
                shadowBlur: 1,
                shadowColor: 'rgba(120, 36, 50, 0.5)',
                shadowOffsetY: 5,
                color: new echarts.graphic.RadialGradient(0.4, 0.3, 1, [{
                    offset: 0,
                    color: 'rgb(251, 118, 123)'
                }, {
                    offset: 1,
                    color: 'rgb(204, 46, 72)'
                }])
            }
        }
    }, {
        name: '2016',
        data: data[1],
        type: 'scatter',
        symbolSize: function (data) {
            return Math.sqrt(data[2]) / 5e2;
        },
        label: {
            emphasis: {
                show: true,
                formatter: function (param) {
                    return param.data[3];
                },
                position: 'top'
            }
        },
        itemStyle: {
            normal: {
                shadowBlur: 10,
                shadowColor: 'rgba(25, 100, 150, 0.5)',
                shadowOffsetY: 5,
                color: new echarts.graphic.RadialGradient(0.4, 0.3, 1, [{
                    offset: 0,
                    color: 'rgb(129, 227, 238)'
                }, {
                    offset: 1,
                    color: 'rgb(25, 183, 207)'
                }])
            }
        }
    }]
};
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
     <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>